package com.sentiment.database.bean;

import java.util.Date;
import java.util.Map;

import org.bson.Document;import org.bson.types.ObjectId;

public class ChartInfo  {
	@Override
	public String toString() {
		return "ChartInfo [_id=" + _id + ", keyword_id=" + keyword_id + ", pageViewRatio=" + pageViewRatio
				+ ", sentimentRatio=" + sentimentRatio + "]";
	}

	public static final String dbName = "SentimentDB";
	public static final String collection = "CharInfo";

	private ObjectId _id;
	private String keyword_id;
	private Map<Date,Integer> pageViewRatio;
	private Map<Date,Double> sentimentRatio;
	
	public ChartInfo(Document doc){
		super();
		_id = doc.getObjectId("_id");
		keyword_id = doc.getString("keyword_id");
	    pageViewRatio = (Map<Date,Integer>)doc.get("pageViewRatio");
	    sentimentRatio = (Map<Date,Double>)doc.get("sentimentRatio");
	}
		
	public ChartInfo(String keyword_id, Map<Date,Integer> pageViewRatio, Map<Date,Double> sentimentRatio) {
		super();
		this.keyword_id = keyword_id;
		this.pageViewRatio = pageViewRatio;
		this.sentimentRatio = sentimentRatio;
	}

	public Document toDocument(){
		return new Document("keyword_id", keyword_id).append("pageViewRatio", pageViewRatio).append("sentimentRatio", sentimentRatio);
	}

	public String get_id() {
		return _id.toString();
	}

	public void set_id(String _id) {
		this._id = new ObjectId(_id);
	}

	public String getKeyword_id() {
		return keyword_id;
	}

	public void setKeyword_id(String keyword_id) {
		this.keyword_id = keyword_id;
	}

	public Map<Date, Integer> getPageViewRatio() {
		return pageViewRatio;
	}

	public void setPageViewRatio(Map<Date, Integer> pageViewRatio) {
		this.pageViewRatio = pageViewRatio;
	}

	public Map<Date, Double> getSentimentRatio() {
		return sentimentRatio;
	}

	public void setSentimentRatio(Map<Date, Double> sentimentRatio) {
		this.sentimentRatio = sentimentRatio;
	}
	
}
